<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - OAuth2 授权服务器</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        
        .login-container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            overflow: hidden;
            max-width: 900px;
            width: 100%;
            display: flex;
        }
        
        .login-left {
            flex: 1;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 60px 40px;
            color: white;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .login-left h1 {
            font-size: 2.5em;
            margin-bottom: 20px;
            font-weight: 700;
        }
        
        .login-left p {
            font-size: 1.1em;
            line-height: 1.6;
            opacity: 0.95;
            margin-bottom: 30px;
        }
        
        .feature-list {
            list-style: none;
        }
        
        .feature-list li {
            padding: 10px 0;
            display: flex;
            align-items: center;
        }
        
        .feature-list li:before {
            content: "✓";
            width: 28px;
            height: 28px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-right: 12px;
            font-weight: bold;
        }
        
        .login-right {
            flex: 1;
            padding: 60px 50px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .login-header {
            text-align: center;
            margin-bottom: 40px;
        }
        
        .login-header h2 {
            color: #333;
            font-size: 2em;
            margin-bottom: 10px;
        }
        
        .login-header p {
            color: #666;
            font-size: 1em;
        }
        
        .form-group {
            margin-bottom: 25px;
        }
        
        .form-group label {
            display: block;
            color: #555;
            font-weight: 600;
            margin-bottom: 8px;
            font-size: 0.95em;
        }
        
        .form-input {
            width: 100%;
            padding: 15px 20px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 1em;
            transition: all 0.3s;
            background: #f8f9fa;
        }
        
        .form-input:focus {
            outline: none;
            border-color: #667eea;
            background: white;
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
        }
        
        .login-button {
            width: 100%;
            padding: 16px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 1.1em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 10px;
        }
        
        .login-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
        }
        
        .login-button:active {
            transform: translateY(0);
        }
        
        .error-message {
            background: #fee;
            border-left: 4px solid #f44336;
            color: #c62828;
            padding: 15px 20px;
            border-radius: 8px;
            margin-bottom: 25px;
            display: flex;
            align-items: center;
        }
        
        .error-message:before {
            content: "⚠";
            font-size: 1.5em;
            margin-right: 12px;
        }
        
        .test-accounts {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            margin-top: 30px;
        }
        
        .test-accounts h3 {
            color: #555;
            font-size: 0.95em;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
        }
        
        .test-accounts h3:before {
            content: "ℹ";
            width: 22px;
            height: 22px;
            background: #667eea;
            color: white;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-right: 8px;
            font-size: 0.9em;
        }
        
        .account-item {
            background: white;
            padding: 12px 16px;
            border-radius: 8px;
            margin: 8px 0;
            display: flex;
            justify-content: space-between;
            font-size: 0.9em;
        }
        
        .account-item .username {
            color: #667eea;
            font-weight: 600;
            font-family: 'Courier New', monospace;
        }
        
        .account-item .password {
            color: #999;
            font-family: 'Courier New', monospace;
        }
        
        @media (max-width: 768px) {
            .login-container {
                flex-direction: column;
            }
            
            .login-left {
                padding: 40px 30px;
            }
            
            .login-right {
                padding: 40px 30px;
            }
            
            .login-left h1 {
                font-size: 2em;
            }
        }
        
        .logo {
            font-size: 3em;
            margin-bottom: 15px;
        }
        
        .version {
            font-size: 0.85em;
            opacity: 0.8;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <!-- 左侧信息面板 -->
        <div class="login-left">
            <div class="logo">🔐</div>
            <h1>OAuth2 授权服务器</h1>
            <p>安全、可靠的企业级OAuth2授权解决方案</p>
            
            <ul class="feature-list">
                <li>标准OAuth2授权码模式</li>
                <li>JWT访问令牌</li>
                <li>细粒度权限控制</li>
                <li>安全的令牌管理</li>
            </ul>
            
            <div class="version">
                Spring Authorization Server 1.2.3
            </div>
        </div>
        
        <!-- 右侧登录表单 -->
        <div class="login-right">
            <div class="login-header">
                <h2>欢迎回来</h2>
                <p>请登录以继续授权流程</p>
            </div>
            
            <!-- 错误消息 -->
            <div th:if="${param.error}" class="error-message">
                登录失败，请检查用户名和密码
            </div>
            
            <div th:if="${param.logout}" class="error-message" style="background: #e8f5e9; border-left-color: #4caf50; color: #2e7d32;">
                您已成功登出
            </div>
            
            <!-- 登录表单 -->
            <form th:action="@{/login}" method="post">
                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="text" 
                           id="username" 
                           name="username" 
                           class="form-input" 
                           placeholder="请输入用户名"
                           autocomplete="username"
                           required
                           autofocus>
                </div>
                
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" 
                           id="password" 
                           name="password" 
                           class="form-input" 
                           placeholder="请输入密码"
                           autocomplete="current-password"
                           required>
                </div>
                
                <button type="submit" class="login-button">
                    🚀 登录
                </button>
            </form>
            
            <!-- 测试账号提示 -->
            <div class="test-accounts">
                <h3>测试账号</h3>
                <div class="account-item">
                    <span class="username">user</span>
                    <span class="password">password</span>
                </div>
                <div class="account-item">
                    <span class="username">admin</span>
                    <span class="password">password</span>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

